package com.example.demo.controller.file;

import com.example.demo.entity.Result;
import com.example.demo.service.file.FileService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @description:
 * @author: cj
 * @create: 09-03-11 09:35:46
 */
@RestController
@RequestMapping("/file")
public class FileController {
    @Resource
    FileService fileService;

    /**
     * 文件上传
     *
     * @param file 文件数据
     * @return 上传的文件信息map
     */
    @PostMapping("/uploadFile")
    public Result uploadFile(@RequestParam("file") MultipartFile file) {
        return Result.ok( fileService.uploadFile( file ) );
    }

}
